import java.util.ArrayList;


public class SchedulingQueue {
	int m;
	int k0;
	int k1;
	int k2;
	ArrayList <RS> subQ0;
	ArrayList <RS> subQ1;
	ArrayList <RS> subQ2;
	
	public SchedulingQueue(int m, int k0, int k1, int k2) {
		this.m = m;
		this.k0 = k0;
		this.k1 = k1;
		this.k2 = k2;
		subQ0 = new ArrayList();
		subQ1 = new ArrayList();
		subQ2 = new ArrayList();
	}
	public ArrayList <RS> getSubQ(int FU) {
		if (FU==0) return subQ0;
		if (FU==1) return subQ1;
		else return subQ2;
	}
	public int size() {
		int temp = 0;
		if(subQ0.size()> subQ1.size()) temp = subQ0.size();
		else temp = subQ1.size();
		
		if(temp < subQ2.size()) temp = subQ2.size();
		return temp;
	}
	public void add(Instruction i, int FU) {
		
		if (FU == 0)
			subQ0.add(new RS(i));
		else if (FU ==1)
			subQ1.add(new RS(i));
		else 
			subQ2.add(new RS(i));
		
		
	}
	
	public boolean notFull(int FU) {
		if (FU == 0)
			return (subQ0.size()<(m*k0));
		else if (FU ==1)
			return (subQ1.size()<(m*k1));
		else 
			return (subQ2.size()<(m*k2));
		
		
	}
	public boolean isEmpty() {
		// TODO Auto-generated method stub
		if (subQ0.size() ==0)
			return true;
		if (subQ1.size() ==0)
			return true;
		if (subQ2.size() ==0)
			return true;
		return false;
	}
	

}
